package com.project.service.impl;

import com.project.bean.StatSellBean;
import com.project.mapper.ISellInfoMapper;
import com.project.mapper.IStatSellMapper;
import com.project.service.IStatSellService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.List;

@Service
public class StatSellServiceImpl implements IStatSellService {
    @Autowired
    private IStatSellMapper statSellMapper;

    /**
     * 根据条件查询每个品牌，每个类别的销售总金额
     *
     * @param startDate 起始时间
     * @param endDate   结束时间
     * @return 销售集合
     */
    @Override
    public List<StatSellBean> findByType(LocalDate startDate, LocalDate endDate) {
        return statSellMapper.findByType(startDate, endDate);
    }

    /**
     * 查询每个类别中的商品的销售金额
     *
     * @param startDate 开始时间
     * @param endDate   结束时间
     * @return 销售统计对象集合
     */
    @Override
    public List<StatSellBean> findByGoods(LocalDate startDate, LocalDate endDate) {
        return statSellMapper.findByGoods(startDate, endDate);
    }
}
